<%@page import="cn.yunhe.entity.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>信息编辑</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="scripts/jquery/jquery-1.7.1.js"></script>
<link href="style/authority/basic_layout.css" rel="stylesheet" type="text/css">
<link href="style/authority/common_style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="scripts/authority/commonAll.js"></script>
<script type="text/javascript" src="scripts/jquery/jquery-1.4.4.min.js"></script>
<script src="scripts/My97DatePicker/WdatePicker.js" type="text/javascript" defer="defer"></script>
<script type="text/javascript" src="scripts/artDialog/artDialog.js?skin=default"></script>
<script type="text/javascript">
	$(document).ready(function() {
		/*
		 * 提交
		 */
		 $("#submitbutton").click(function() {
				validateForm();
				parent.$.fancybox.close();
		}); 
		 /* $("#submitbutton").click(function() {
			 validateForm()
			 
			 /* if(){
				// $("#submitForm").attr("action", "DoEnroll?opt=update").submit();
				 $("#submitForm").attr("action","../DoUser?opt=add").submit(); //提交
	             parent.$.fancybox.close(); //关闭
	             //parent.window.location.reload(); //刷新父窗口
				//checkpwdSubmit();
			} 
		});*/ 
		
		 function checkpwdSubmit(){
			// 分别获取user的信息
			var province = $('#province').val();
			var wenorli = $("#wenorli").val();
			var email = $("#email").val();
			var username = $("#username").val();	
			var pwd = $("#pwd").val();
			if(province!="" && email!="" && username!="" && pwd!=""&&wenorl!=""){
				
				$.ajax({
					type:"POST",
					url:"../DoUser?opt=update&userid=${params.user.userid}",
					data:{"wenorli":wenorli,"province":province, "email":email, "username":username, "pwd":pwd},
					dataType : "text",
					success:function(){
	 					 alert("操作成功");
	 					parent.$.fancybox.close();
					}
				});
			}
			return true;
		}  
		/*
		 * 取消
		 */
		 $("#cancelbutton").click(function() {
			/**  关闭弹出iframe  **/
			window.parent.$.fancybox.close();
		});
		 $("#submitbutton").click(function() {
				/**  关闭弹出iframe  **/
				window.parent.$.fancybox.close();
			});
		
		var result = 'null';
		if(result =='success'){
			/**  关闭弹出iframe  **/
			window.parent.$.fancybox.close();
		} 
	});
	
	/** 表单验证  **/
	function validateForm(){
		if($("#email").val()==""){
			art.dialog({icon:'error', title:'友情提示', drag:false, resize:false, content:'填写邮箱', ok:true,});
			return false;
		}
		if($("#username").val()==""){
			art.dialog({icon:'error', title:'友情提示', drag:false, resize:false, content:'填写用户名', ok:true,});
			return false;
		}
		if($("#pwd").val()==""){
			art.dialog({icon:'error', title:'友情提示', drag:false, resize:false, content:'填写密码', ok:true,});
			return false;
		}
		if($("#province").val()==""){
			art.dialog({icon:'error', title:'友情提示', drag:false, resize:false, content:'填写省份', ok:true,});
			return false;
		}
		if($("#wenorli").val()==""){
			art.dialog({icon:'error', title:'友情提示', drag:false, resize:false, content:'填写文或理', ok:true,});
			return false;
		}
		if($("#phon").val()==""){
			art.dialog({icon:'error', title:'友情提示', drag:false, resize:false, content:'填写手机号', ok:true,});
			return false;
		}
		return true;
	}
</script>
</head>
<body>
<form id="submitForm" name="submitForm" action="../DoUser?opt=add" method="post">
	<input type="hidden" name="fyID" value="14458625716623" id="fyID"/>
	<div id="container">
		<div id="nav_links">
			当前位置：表单管理&nbsp;>&nbsp;<span style="color: #1A5CC6;">用户管理</span>
			<div id="page_close">
				<a href="javascript:parent.$.fancybox.close();">
					<img src="images/common/page_close.png" width="20" height="20" style="vertical-align: text-top;"/>
				</a>
			</div>
		</div>
		<div class="ui_content">
			<table  cellspacing="0" cellpadding="0" width="100%" align="left" border="0">
				<tr>
					<td class="ui_text_rt">邮箱</td>
					<td class="ui_text_lt">
						<input type="text" name="email" id="email" class="ui_input_txt02" value="${params.user.email}"/>
					</td>
				</tr>
				<tr>
					<td class="ui_text_rt">用户名</td>
					<td class="ui_text_lt">
						<input type="text" id="username" name="username" class="ui_input_txt02" value="${u.username}"/>
					</td>
				</tr>
				<tr>
					<td class="ui_text_rt">密码</td>
					<td class="ui_text_lt">
						<input type="text" id="pwd" name="pwd"  class="ui_input_txt02" value="${u.pwd}"/>
					</td>
				</tr>
				<tr>
					<td class="ui_text_rt">省份</td>
					<td class="ui_text_lt">
					<c:set value="${sessionScope.plist}" var="prolist"></c:set>
							<select id="province" name="province" class="ui_select01" onChange="getemailListByFyXqCode();">
                                <option value="">--请选择--</option>
                               <c:forEach items="${prolist}" var="provin">
                               		 <option >${provin.provience}</option>
                                </c:forEach>
                                
                     </select>
					</td>
				</tr>
				<tr>
					<td class="ui_text_rt">文或理</td>
					<td class="ui_text_lt">
						<select id="wenorli" name="wenorli" class="ui_select01">
							<option value="1">文</option>
							<option value="0">理</option>
						</select>
					</td>
				</tr>
				<tr>
					<td class="ui_text_rt">手机号</td>
					<td class="ui_text_lt">
						<input type="text" name="phon" id="phon" class="ui_input_txt02" value="${u.userphone}"/>
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td class="ui_text_lt">
						&nbsp;<input id="submitbutton" type="submit" value="提交" class="ui_input_btn01"/>
						&nbsp;<input id="cancelbutton" type="button" value="取消" class="ui_input_btn01"/>
					</td>
				</tr>
			</table>
		</div>
	</div>
</form>
</body>
</html>